/*
 *The code is written by NaLi, All rights reserved.
 */
package com.nali.dal.statement.function.formatter;

import java.util.Collections;
import java.util.Map;

import com.nali.dal.statement.function.FunctionException;
import com.nali.dal.statement.function.SingleArgumentDataHandler;

/**
 * @author gavin 
 * Created on 2011-4-9
 */
public class ConstantToString extends SingleArgumentDataHandler<Integer, String> {
	private Map<Integer, String> map = Collections.emptyMap();
	
	public Map<Integer, String> getMap() {
		return map;
	}

	public void setMap(Map<Integer, String> map) {
		this.map = map;
	}

	@Override
	public String handle(Integer obj) throws FunctionException {
		 String val = this.map.get(obj);
		 if(val == null) {
			 return String.valueOf(obj);
		 }
		 return val;
	}
}

